#include<iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
class Solution {
public:
    int tran(string& t) {
        int hour = (t[0] - '0') * 10 + (t[1] - '0');
        int minu = (t[3] - '0') * 10 + (t[4] - '0');
        return hour * 60 + minu;
    }
    int findMinDifference(vector<string>& timePoints) {
        int n = timePoints.size();
        vector<int> time(n);
        for (int i = 0; i < n; ++i)
            time[i] = tran(timePoints[i]);
        sort(time.begin(), time.end());
        int t = time[0] + 24 * 60 - time.back();
        for (int i = 1; i < n; ++i)
            t = min(time[i] - time[i - 1], t);
        return t;
    }
};